delete FAKE_LANGUAGE_MENU code. (#681)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Fri, 5 Feb 2021 16:48:33 +0000 (09:48 -0700)
committerGitHub <noreply@github.com>
Fri, 5 Feb 2021 16:48:33 +0000 (09:48 -0700)
This code hadn't compiled for a while, and is no longer necessary
to test translations.

gui/mainwindow.cc
gui/mainwindow.h

index 915d75e2aa9fd6b4c62e22d7a07bc10deef93b7c..0197ecb3061eae38ccf69c9e2a99b003a68741ea 100644 (file)
@@ -80,8 +80,6 @@ const int BabelData::noType_ = -1;
 const int BabelData::fileType_ = 0;
 const int BabelData::deviceType_ = 1;
 
-#define FAKE_LANGUAGE_MENU 0
-
 //------------------------------------------------------------------------
 QString MainWindow::findBabelVersion()
 {
@@ -224,9 +222,6 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
   // Start up in the current system language.
   loadLanguage(QLocale::system().name());
   loadFormats();
-#if FAKE_LANGUAGE_MENU
-  createLanguageMenu();
-#endif
 
   //--- Restore from registry
   restoreSettings();
@@ -252,48 +247,6 @@ MainWindow::~MainWindow()
   delete upgrade;
 
 }
-//------------------------------------------------------------------------
-// Dynamic language switching courtesy of
-// http://developer.qt.nokia.com/wiki/How_to_create_a_multi_language_application
-// We create the menu entries dynamically, dependant on the existing
-// translations.
-#if FAKE_LANGUAGE_MENU
-void MainWindow::createLanguageMenu(void)
-{
-  QActionGroup* langGroup = new QActionGroup(ui.menuHelp);
-  langGroup->setExclusive(true);
-  connect(langGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotLanguageChanged(QAction*)));
-
-  // format systems language
-  QString defaultLocale = QLocale::system().name();       // e.g. "de_DE"
-  defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
-
-  QDir dir(langPath);
-  QStringList fileNames = dir.entryList(QStringList("GPSBabelFE*.qm"));
-
-  for (int i = 0; i < fileNames.size(); ++i) {
-    // get locale extracted by filename
-    QString locale;
-    locale = fileNames[i];                  // "TranslationExample_de.qm"
-    locale.truncate(locale.lastIndexOf('.'));   // "TranslationExample_de"
-    locale.remove(0, locale.indexOf('_') + 1);   // "de"
-
-    QString lang = QLocale::languageToString(QLocale(locale).language());
-
-    QAction* action = new QAction(lang, this);
-    action->setCheckable(true);
-    action->setData(locale);
-
-    ui.menuHelp->addAction(action);
-    langGroup->addAction(action);
-
-    // set default translators and language checked
-    if (defaultLocale == locale) {
-      action->setChecked(true);
-    }
-  }
-}
-#endif //  FAKE_LANGUAGE_MENU
 
 //------------------------------------------------------------------------
 // Called every time, when a menu entry of the language menu is called
index b6de39944f4b7718a7d30c3902a729e7d32bd2b3..51a0dd7283652177a5b3528447d3e448f0fc7946 100644 (file)
@@ -75,7 +75,6 @@ private:
   void loadFormats();
   void loadLanguage(const QString& rLanguage);
   void switchTranslator(QTranslator&, const QString&);
-  void createLanguageMenu();
   QString filterForFormat(int idx);
   QString ensureExtensionPresent(const QString& nanme, int idx);
   QString findBabelVersion();